import MainContainerCustom from '@/components/MainContainerCustom';
import { Button } from '@antmjs/vantui';
import Taro from '@tarojs/taro';
import { CDatetimePickerVantCustom } from '@vh-mobile/pro-components';
import { eventsBus } from '@vh-mobile/pro-utils';

export default function DemoDatetimePickerVant() {
  const eventName: any = 'datetimePickerVant1';

  const onClick = () => {
    console.log(Taro);
    eventsBus.$pageTrigger(eventName, {
      value: '2020-01-04',
      type: 'year',
      valueFormat: 'YYYY-MM-DD ',
      // defaultValue: '2020-01-04',
      onChange: (value: any) => {
        console.log('===================');
        console.log(value);
        console.log('===================');
      },
    });
  };

  // console.log(loadData);

  return (
    <MainContainerCustom>
      <Button onClick={onClick} type="primary" block={true}>
        点击选择
      </Button>
      {/* //如果有公用的可以直接调用不需要引入组件 */}
      <CDatetimePickerVantCustom value={undefined} onChange={() => {}} eventName={eventName} />
    </MainContainerCustom>
  );
}
